package com.hg.avaya.util;

import java.util.Collection;
import java.util.Iterator;

import com.avaya.sce.runtime.Goto;

/**
 * @author litong
 * @date 2019-3-31
 *
 */
public class BranchesUtil {
  /**
   * 设置 goto的目标
   * @param branches
   * @param name
   */
  public static void setBranches(Collection branches, String name) {
    Goto agoto = null;
    Iterator iterator = branches.iterator();
    while (iterator.hasNext()) {
      Goto item = (Goto) iterator.next();
      if (item.getName().equals(name)) {
        agoto = item;
        break;
      }
    }
    branches.clear();// 清空下一个流程,添加流程
    branches.add(agoto);
  }

}
